﻿using FluentNHibernate.Mapping;
using Romantics.Domain.Objects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Romantics.Domain.Mappings
{
    class PhotoAlbumItemMap : ClassMap<PhotoAlbumItem>
    {
        public PhotoAlbumItemMap()
        {
            Id(x => x.ID);

            Map(x => x.URL)
                .Not.Nullable();

            Table("ALBUM_ITEM");

            Map(x => x.Description)
                .CustomType("StringClob")
                .CustomSqlType("NVARCHAR(MAX)");

            Map(x => x.Small)
                .Column("URL_SMALL")
                .Not.Insert()
                .Not.Update()
                .Not.Nullable();

            Map(x => x.Middle)
                .Column("URL_MIDDLE")
                .Not.Insert()
                .Not.Update()
                .Not.Nullable();

            Map(x => x.Large)
                .Column("URL_LARGE")
                .Not.Insert()
                .Not.Update()
                .Not.Nullable();

            Map(x => x.XLarge)
                .Column("URL_XLARGE")
                .Not.Insert()
                .Not.Update()
                .Not.Nullable();

            References(x => x.PhotoAlbum)
                .Column("ALBUM_ID")
                .Not.Nullable();
        }
    }
}
